package com.winning.vsts.merge;

import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus;
import com.winning.vsts.merge.service.domain.VstsProject;
import com.winning.vsts.merge.service.entity.PullRequestDO;
import com.winning.vsts.merge.service.service.VstsProjectService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 工作项相关测试
 *
 * @author xcl <xcl@winning.com.cn>
 * @date 2021/11/18
 */
@EnableJpaRepositories(basePackages = "com.winning.vsts.merge.service.jpa")
@SpringBootApplication(scanBasePackages = "com.winning.vsts.merge.service")
public class debugApplication implements ApplicationRunner {

    @Autowired
    private VstsProjectService vstsProjectService;

    @Autowired
    private EventBus eventBus;

    private final static Logger log = LoggerFactory.getLogger(AutoMergeApplication.class);

    public static void main(String[] args) {
        new SpringApplicationBuilder()
            .main(debugApplication.class)
            .sources(debugApplication.class)
            .web(WebApplicationType.NONE)
            .build().run(args);
    }


    @Override
    public void run(ApplicationArguments args) throws Exception {
        String hospitalSOID = "993718|";
        String[] soidStrArr = hospitalSOID.split("\\|");
List<String> l = Arrays.asList(soidStrArr);
        for (int i=0; i<soidStrArr.length; i++) {
            log.info("===================={}===================", soidStrArr[i]);
        }

        // 停1分钟给多线程处理
        TimeUnit.MINUTES.sleep(1);
    }
}
